﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class OutboundDetailService : IOutboundDetailService
    {
        public string DeleteWave(string waveID, List<string> IDS, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveDetailBLL(pubParasInfo).DeleteWave(waveID, IDS);
                new OperationLogBLL(pubParasInfo).Insert("OutboundDetailService_DeleteWaveDetail", waveID, IDS, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public DataSet GetAllIntransitDetail(PubParasInfo pubParasInfo)
        {
            DataSet ds = new DataSet();
            try
            {
                IntransitDetailBLL intransitDetailBll = new IntransitDetailBLL(pubParasInfo);
                return intransitDetailBll.GetAllIntransitDetail();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundDetailService异常");
            }
            return ds;
        }

        public DataSet GetAllWaveDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                WaveDetailBLL waveDetailBLL = new WaveDetailBLL(pubParasInfo);
                return waveDetailBLL.GetAllWaveDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return null;
        }

        public IntransitDetailInfo GetIntransitDetailInfoByID(string IntransitID, string LineID, string srcDbID, PubParasInfo pubParasInfo)
        {
            try
            {
                IntransitDetailBLL intransitDetailBll = new IntransitDetailBLL(srcDbID);
                return intransitDetailBll.GetIntransitDetailInfoByID(IntransitID, LineID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundDetailService异常");
            }
            return null;
        }

        public string InsertWaveDetail(WaveDetailInfo obj, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveDetailBLL(pubParasInfo).InsertWaveDetail(obj);
                new OperationLogBLL(pubParasInfo).Insert("OutboundDetailService_InsertWaveDetail", obj, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string SaveWavebyOrderSelection(WaveDetailInfo waveDetail, List<string> Ids, List<string> Status, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveDetailBLL(pubParasInfo).SaveWavebyOrderSelection(waveDetail, Ids, Status);
                new OperationLogBLL(pubParasInfo).Insert("OutboundDetailService_SaveWavebyOrderSelection", waveDetail, Ids, Status, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }

        public string UpdateWaveDetail(WaveDetailInfo obj, PubParasInfo pubParasInfo)
        {
            string returnStr = string.Empty;
            try
            {
                returnStr = new WaveDetailBLL(pubParasInfo).UpdateWaveDetail(obj);
                new OperationLogBLL(pubParasInfo).Insert("OutboundDetailService_UpdateWaveDetail", obj, pubParasInfo);
                return returnStr;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "OutboundService异常");
            }
            return returnStr;
        }
    }
}

